<!DOCTYPE html>
<html>
<head>
<title>login</title>
<@s.css 'login.css' />
<@s.script ['jquery-1.7.2.min.js','jquery.form.js','sha1.js','jquery.validator.js'] />
<script type='text/javascript'>
<!--
$(document).ready(function(){
	$('#loginForm').validator({
	    msgHandler: function(msgs){
	        $.map(msgs, function(msg){
	        	showMessage(msg,"fail");
	        });
	    }
	});
	$('#loginMail').focus();
	$('#loginForm').ajaxForm({
		beforeSerialize:function(){
			$('#loginPwd').val(CryptoJS.SHA1($('#loginPwd').val()));
		},
		beforeSubmit: function(a,f,o) {
			return true;
	    },
	    dataType:"json",
	    success: function(json) {
	    	if(json.state){
	    		location.href="/oper/index.do";
	    	}else{
	    		showMessage(json.message,"fail");
	    		$('#loginPwd').val("");
	    		$("#captcha").val("");
	    		$('#captchaImage').attr('src','/security/captcha.htm?_='+Math.random());
	    	}
	    }
	});
})
//-->
</script>
</head>
<body>
	<div class="m-form">
		<form name="loginForm" id="loginForm" action="<@s.url '/auth/login.htm' />" method="post" >
			<h1>账户登录</h1>
			<div class="formitm">
				<label class="lab form-label">邮箱：</label>
				<div class="ipt">
					<input type="text" name="loginMail" id="loginMail" data-rule="登录邮箱:required;email" placeholder="登录邮箱" />
					<a href="javascript:;">注册账号</a>
				</div>
			</div>
			<div class="formitm">
				<label class="lab">密码：</label>
				<div class="ipt">
					<input type="password" name="loginPwd" id="loginPwd" data-rule="登录密码:required;password" placeholder="登录密码" />
					<a href="/auth/forget_pwd.htm" target="_blank">忘记密码</a>
				</div>
			</div>
			<div class="formitm">
				<label class="lab">验证码：</label>
				<div class="ipt">
					<input type="text" name="captcha" data-rule="验证码:required"  placeholder="验证码" style="width: 100px;" id="captcha"/>
					<a href="javascript:;" onclick="$('#captchaImage').attr('src','/security/captcha.htm?_='+Math.random());">看不清？换一张</a>
					<p class="tip">
						<@s.captcha />
					</p>
				</div>
			</div>
			<div class="formitm formitm-submit">
				<button class="u-btn" type="submit">立 即 登 录</button>
			</div>
		</form>
		<@s.message />
	</div>

</body>
</html>